%module ImageServer

/**
 *
 * $Id: ImageServer.i,v 1.1 2009-06-07 22:24:08 ttaipalu Exp $
 *
 * \file
 * \brief Python wrap for MaCI - Image Server interface
 * \author Antti Maula <antti.maula@tkk.fi>
 * \author Tapio Taipalus <tapio.taipalus@tkk.fi>
 */
%{
#include "MaCI.hpp"
#include "ImageData.hpp"
#include "ImageServer.hpp"
#include "sync.hpp"
#include "thread.hpp"
#include <list>
%}

%include "std_list.i"
%include "std_string.i"
%include "ImageData.i"
%include "../MaCIError.i"
%include "../MaCI.i"
%include "../MaCICtrl/MaCICtrlServer.i"

// Forward declare gimi::GIMI
namespace gimi {
  class GIMI;
  class GIMIMessage;
}

namespace MaCI {
  namespace Image {

    /** MaCI - Image Server interface
     * 
     * This class contains the methods and types for providing
     * the Image service in the GIMnet.
     */
    class CImageServer : public MaCI::CMaCI,
                         private gim::CSync,
                         private gim::CThread
    {
    public:
      /** Constructor.
       * 
       * Constructor of the ImageServer. This requires;
       * a pointer to Initialized and connected GIMI, minor
       * number of this interface (Used as GIMI minor number)
       *
       * @param[in] aMaCICtrlServerPtr Pointer to GIMI used for communication
       * @param[in] aInterfaceMinor Interface minor number. Usually
       * used to indicate the instance of devices of same type.
       * @param[in] aDescription User provided description about
       * service. This description will be appended after text
       * 'MaCI-ImageServer; ' in the GIMI service description
       * field.
       * @param[in] aInstanceName Specify Instance name here.
       */
      CImageServer(MaCICtrl::CMaCICtrlServer *aMaCICtrlServerPtr, 
                   const int aInterfaceMinor,
                   const std::string &aDescription = "",
                   const std::string &aInstanceName = "");


      /** Destructor.
       */
      ~CImageServer();
 

      /** Send ImageData element with any number of images.
       *
       * This function sends an ImageData container to service subscribers.
       * 
       * @param[in] aImageData  CImageData container containing data to send.
       * @return                Returns a value of type MaCI::EMaCIError. 
       */
      MaCI::EMaCIError SendImageData(const MaCI::Image::CImageData &aImageData);


      
      /** Set source information.
       *
       * This function stores the SourceInfo in container inside this
       * ImageServer instance. Multiple SourceInformations can be
       * added if multiple imagesources are in use. For example; if
       * you have a stereo camerasystem, you could add two information
       * elements with another SourceIndex set to 0 and another set to
       * 1. The ImageData contains the Index per Image basis, and the
       * Client can decode the image source by combining these fields.
       *
       * \note If you set source with same sourceindex twise, the
       * previous information will be replaced.
       *
       * @param[in] aInfo       SourceInfo to add.
       */
      void SetSourceInfo(const MaCI::Image::TSourceInfo &aInfo);
      
    };

  }
}

